package com.lx.patterns.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName Home
 * @Description: 主人的➕
 * @Author: 落雪
 * @CreateDate: 2025/2/15 14:14
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/2/15 14:14
 * @UpdateRemark:
 * @Version: 1.0
 */
public class Home {

    private List<Animal> animalList = new ArrayList<Animal>();

    public void add(Animal animal){
        animalList.add(animal);
    }

    public void action(Person person){
        for (Animal animal : animalList) {
            animal.accept(person);
        }
    }
}
